Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@turf/bearing
Advanced tools
@turf/bearing is a module within the Turf.js library that provides geospatial analysis tools. Specifically, it calculates the bearing between two geographical points. This is useful in various applications such as navigation, mapping, and geographic information systems (GIS).
Calculate Bearing
This feature calculates the bearing between two geographical points. The bearing is the angle between the north direction and the line connecting the two points, measured in degrees.
const turf = require('@turf/turf');
const point1 = turf.point([0, 0]);
const point2 = turf.point([10, 10]);
const bearing = turf.bearing(point1, point2);
console.log(bearing);
Calculate Bearing with Initial and Final Bearings
This feature allows you to calculate both the initial and final bearings between two points. The initial bearing is the angle at the starting point, while the final bearing is the angle at the destination point.
const turf = require('@turf/turf');
const point1 = turf.point([0, 0]);
const point2 = turf.point([10, 10]);
const initialBearing = turf.bearing(point1, point2, {final: false});
const finalBearing = turf.bearing(point1, point2, {final: true});
console.log(`Initial Bearing: ${initialBearing}, Final Bearing: ${finalBearing}`);
Geolib is a library for geospatial calculations. It provides functions to calculate distances, bearings, and other geographic information. Compared to @turf/bearing, Geolib offers a broader range of geospatial functionalities but may not be as specialized in GIS analysis.
Geodesy is a library for geodesic calculations. It includes methods for calculating distances, bearings, and other geospatial metrics. It is similar to @turf/bearing in terms of bearing calculation but also includes more advanced geodesic functions.
Takes two points and finds the geographic bearing between them, i.e. the angle measured in degrees from the north line (0 degrees)
Parameters
start
Coord starting Pointend
Coord ending Pointoptions
Object Optional parameters (optional, default {}
)
options.final
boolean calculates the final bearing if true (optional, default false
)Examples
var point1 = turf.point([-75.343, 39.984]);
var point2 = turf.point([-75.534, 39.123]);
var bearing = turf.bearing(point1, point2);
//addToMap
var addToMap = [point1, point2]
point1.properties['marker-color'] = '#f00'
point2.properties['marker-color'] = '#0f0'
point1.properties.bearing = bearing
Returns number bearing in decimal degrees, between -180 and 180 degrees (positive clockwise)
This module is part of the Turfjs project, an open source module collection dedicated to geographic algorithms. It is maintained in the Turfjs/turf repository, where you can create PRs and issues.
Install this module individually:
$ npm install @turf/bearing
Or install the Turf module that includes it as a function:
$ npm install @turf/turf
6.5.0
@turf/points-with-polygon
Add MultiPoint support
(PR https://github.com/Turfjs/turf/pull/2137 - Author @twelch)@turf/dissolve
Complete rewrite of the dissolve module to resolve many bugs
(PR https://github.com/Turfjs/turf/pull/2110 - Author @rowanwins)
@turf/mask
Complete rewrite of the mask module to resolve many bugs
(PR https://github.com/Turfjs/turf/pull/2130 - Author @rowanwins)
@turf/boolean-valid
Add missing dependency to
(PR https://github.com/Turfjs/turf/pull/2094 - Author @rycgar)
@turf/boolean-overlap
Improve clarity
(PR https://github.com/Turfjs/turf/pull/2133 - Author @patrickbrett)FAQs
turf bearing module
The npm package @turf/bearing receives a total of 0 weekly downloads. As such, @turf/bearing popularity was classified as not popular.
We found that @turf/bearing demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.